//用户协议管理



import React, { useEffect, useState } from 'react';
import { Button, Tag } from 'antd';
import { getwailian } from '../../utils/api.tsx';
import Tbale from '../ContentManagement/content_components/Tbale.tsx';
import moment from 'moment';
import Toptitle from '../../Compon/Toptitle.tsx';
export default function UserAgreement() {
  useEffect(() => {
    getwailianList();
  }, []);
  const [wailian, setwailian] = useState([]);
  const getwailianList = async () => {
    const res = await getwailian();
    console.log(res);
    setwailian(res.data.data);
  };
  const columns = [
    {
      title: '序号',
      dataIndex: '_id',
      key: '_id_',
      render: (text, record, index) => index + 1,
    },
    {
      title: 'ID',
      dataIndex: 'appID',
      key: 'appID',
    },
    {
      title: '标题',
      dataIndex: 'title',
      key: 'title',
    },
    {
      title: '外连接编码',
      dataIndex: 'appcode',
      key: 'appcode',
    },
    {
      title: '外连接地址',
      dataIndex: 'url',
      key: 'url',
      render: (text, record, index) => {
        return (
          <div>
            <a href="">{text}</a>
          </div>
        );
      },
    },
    {
      title: '发布时间',
      dataIndex: 'start_time',
      key: 'start_time',
      render: (text, record, index) => {
        return <div>{moment(text).format('YYYY-MM-DD HH:mm:ss')}</div>;
      },
    },
    {
      title: '状态',
      dataIndex: 'status',
      key: 'status',
      render: (text, record, index) => {
        return (
          <div>
            <Tag color={text == 1 ? 'green' : 'red'}>
              {text == 1 ? '已发布' : '未发布'}
            </Tag>
          </div>
        );
      },
    },
    {
      title: '操作',
      dataIndex: 'operation',
      key: 'operation',
      render: (text, record, index) => {
        return (
          <div>
            <Button type="primary">编辑</Button>
          </div>
        );
      },
    },
  ];
  return (
    <div>
      <Toptitle title="app外链设置" />
      <Tbale data={wailian} colums={columns}></Tbale>
    </div>
  );
}
